﻿Imports Microsoft.VisualStudio.TestTools.UnitTesting

Imports Alquilaqi

'''<summary>
'''This is a test class for InmuebleNegocioTest and is intended
'''to contain all InmuebleNegocioTest Unit Tests
'''</summary>
<TestClass()> _
Public Class InmuebleNegocioTest


    Private testContextInstance As TestContext

    '''<summary>
    '''Gets or sets the test context which provides
    '''information about and functionality for the current test run.
    '''</summary>
    Public Property TestContext() As TestContext
        Get
            Return testContextInstance
        End Get
        Set(ByVal value As TestContext)
            testContextInstance = Value
        End Set
    End Property

#Region "Additional test attributes"
    '
    'You can use the following additional attributes as you write your tests:
    '
    'Use ClassInitialize to run code before running the first test in the class
    '<ClassInitialize()>  _
    'Public Shared Sub MyClassInitialize(ByVal testContext As TestContext)
    'End Sub
    '
    'Use ClassCleanup to run code after all tests in a class have run
    '<ClassCleanup()>  _
    'Public Shared Sub MyClassCleanup()
    'End Sub
    '
    'Use TestInitialize to run code before running each test
    '<TestInitialize()>  _
    'Public Sub MyTestInitialize()
    'End Sub
    '
    'Use TestCleanup to run code after each test has run
    '<TestCleanup()>  _
    'Public Sub MyTestCleanup()
    'End Sub
    '
#End Region


    '''<summary>
    '''A test for InmuebleNegocio Constructor
    '''</summary>


    Public Sub insertarInmuebleTest()
        Dim negocio As New InmuebleNegocio()

        Try
            negocio.insertarInmueble(5, 1, "2011-09-25", 203, "Mz P ", 1, "Cuarto mediano", "a", "a", "Habilitado", " ", 1)
        Catch ex As ApplicationException
            Assert.Fail(ex.Message)
        End Try

    End Sub


    'Public Sub actualizarTest()
    '    Dim negocio As New InmuebleNegocio()

    '    Try
    '        negocio.actualizar(9, "2011-10-03", 21, "LIMA", 3, "departamento", "", "", "HABILITADO", "", 1)

    '        Dim nuevo = negocio.obtener(9)
    '        'Assert.AreEqual("OCUPADO", nuevo.Estado)


    '    Catch ex As Exception
    '        Assert.Fail(ex.ToString())
    '    End Try

    'End Sub

    <TestMethod()> _
    Public Sub obtenerTest()
        Dim negocio As New InmuebleNegocio()

        Try

            Dim modelo = negocio.obtener(8)

            Assert.AreNotEqual(0, modelo.idInmueble)

            Assert.AreEqual("Habilitado", modelo.Estado)

        Catch ex As Exception
            Assert.Fail(ex.ToString())
        End Try
    End Sub


    Public Sub ListarTest()
        Dim negocio As New InmuebleNegocio()
        Dim todos = negocio.listar()
        Assert.AreEqual(2, todos.Count)
    End Sub




    Public Sub eliminarTest()
        Dim negocio As New InmuebleNegocio()

        Try
            negocio.eliminar(8)
        Catch ex As Exception
            Assert.Fail(ex.ToString())
        End Try
    End Sub


End Class
